package ru.infosystem.client.frame;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JRootPane;

/**
 *
 * @author akoshi
 */

public class ProgressBar extends JDialog {
    
    private JProgressBar progress;
    
    public ProgressBar( JFrame parent ) {
        
        super(parent, false);
        JPanel contentPane = new JPanel(new GridLayout(1, 1));

        progress = new JProgressBar();
        progress.setIndeterminate(true);
        progress.setStringPainted(true);
        progress.setString("Connecting...");

        contentPane.add(progress);
        setContentPane(contentPane);

        setResizable(false);
        setLocationRelativeTo(parent);
        setSize(120, 25);
        setUndecorated(true);
        getRootPane().setWindowDecorationStyle(JRootPane.NONE);

        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (int) ((dimension.getWidth() - getWidth()) / 2);
        int y = (int) ((dimension.getHeight() - getHeight()) / 2);
        setLocation(x, y);
    }
}
